<%-- 
    Document   : adicionarMesa
    Created on : 13/11/2011, 01:22:20
    Author     : KOMATSU
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    
    <body><div id="container"><div id="content">
        <%@include file="topo.jsp" %>
        <%@ page import="br.objetos.*, java.util.*" %>
        <%
            UsuarioMetodos um = new UsuarioMetodos();
            um = (UsuarioMetodos)session.getAttribute("usuario");
            session.setAttribute("usuario", um);
        %>
        <table border="0" cellspacing="5" cellpadding="5" width="100%">
            <tr>
                <th>
                     <%if(um.getUsuario().getUsername().equals("admin")){%>
                    <%@include file="abalateral.jsp" %>
                    <%}else{
                    %>
                    <%@include file="abalaterallivre.jsp" %>
                    <%
                    }%>
                </th>
            </tr><tr>
                <th align ="left">
                      <h1>Adicionar Mesa</h1>
                       <%
                            MesaMetodos mm = new MesaMetodos();
                            mm.buscarGarcom();
                            if (request.getParameter("inserted") != null) {
                                if (request.getParameter("inserted").equals("ok")) {
                        %>
                        <p>Mesa adicionada com sucesso.</p>
                        <%
                            }else{
                          %>
                        <p>Mesa <%=session.getAttribute("idmesa")%> já foi adicionada.</p>
                        <%           
                            }
                           }
                        %>
                    <form action="gerenciarMesaDo.jsp?estado=add" method="post">
                        <table border="0" cellspacing="2">
                            <tr>
                                <th align="right">Nº : </th>
                                <th align="left">
                                    <input type="text" name="num" size="3">
                                <th/>
                            </tr>
                            <tr>
                                <th align="right">Garçom: </th>
                                <th align="left">
                                    <select name="idfunc">
                                        <%
                                        List listaG = new ArrayList();
                                            listaG = mm.getListaGarcom();
                                        for (Iterator it = listaG.iterator(); it.hasNext();) {
                                                Funcionario func = (Funcionario) it.next();
                            %>
                                    <option value="<%=func.getIdFunc()%>"><%=func.getPessoa().getNome()%>
                                         <% 
                                        }
                            %>

                                    </select>
                                <th/>
                            </tr>
                            <tr>
                                <th></th>
                                <th><input type="submit" value="ADD" /></th>
                            </tr>
                        </table>
                    </form>
                </th>
            </tr>
        </table>
            
        
    </div><div id="footer" align="center"><%@include file="footer.jsp" %></div></div></body>
</html>


